<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
		
		<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
		
		<title>{{title}}</title>
		
		<!--                       CSS                       -->
	  
		<!-- Reset Stylesheet -->
		<link rel="stylesheet" href="/static/resources/css/reset.css" type="text/css" media="screen" />
	  
		<!-- Main Stylesheet -->
		<link rel="stylesheet" href="/static/resources/css/style.css" type="text/css" media="screen" />
		
		<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
		<link rel="stylesheet" href="/static/resources/css/invalid.css" type="text/css" media="screen" />	
		
		<!-- Colour Schemes
	  
		Default colour scheme is green. Uncomment prefered stylesheet to use it.
		
		<link rel="stylesheet" href="/static/resources/css/blue.css" type="text/css" media="screen" />
		
		<link rel="stylesheet" href="/static/resources/css/red.css" type="text/css" media="screen" />  
	 
		-->
		
		<!-- Internet Explorer Fixes Stylesheet -->
		
		<!--[if lte IE 7]>
			<link rel="stylesheet" href="/static/resources/css/ie.css" type="text/css" media="screen" />
		<![endif]-->
		
		<!--                       Javascripts                       -->
  
		<!-- jQuery -->
		<script type="text/javascript" src="/static/resources/scripts/jquery-1.3.2.min.js"></script>
		
		<!-- jQuery Configuration -->
		<script type="text/javascript" src="/static/resources/scripts/simpla.jquery.configuration.js"></script>
		
		<!-- Facebox jQuery Plugin -->
		<script type="text/javascript" src="/static/resources/scripts/facebox.js"></script>
		
		<!-- jQuery WYSIWYG Plugin -->
		<script type="text/javascript" src="/static/resources/scripts/jquery.wysiwyg.js"></script>
		
		<!-- jQuery Datepicker Plugin -->
		<script type="text/javascript" src="/static/resources/scripts/jquery.datePicker.js"></script>
		<script type="text/javascript" src="/static/resources/scripts/jquery.date.js"></script>
		<!--[if IE]><script type="text/javascript" src="/static/resources/scripts/jquery.bgiframe.js"></script><![endif]-->

		
		<!-- Internet Explorer .png-fix -->
		
		<!--[if IE 6]>
			<script type="text/javascript" src="/static/resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
			<script type="text/javascript">
				DD_belatedPNG.fix('.png_bg, img, li');
			</script>
		<![endif]-->
		<script type="text/javascript">     
		function countDown(secs,surl){     
			 //alert(surl);     
			 var jumpTo = document.getElementById('jumpTo');
			 jumpTo.innerHTML=secs;  
			 if(--secs>0){     
			     setTimeout("countDown("+secs+",'"+surl+"')",1000);     
			 }     
			 else{       
			     location.href=surl;     
			 }     
		 }     
		</script>
		
	</head>
  
	<body><div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
		
		<div id="sidebar"><div id="sidebar-wrapper"> <!-- Sidebar with logo and menu -->
			
				<h1 id="sidebar-title"><a href="/">{{title}}</a></h1>
		  
			<!-- Logo (221px wide) -->
			<a href="#"><img id="logo" src="/static/resources/images/logo.png" alt="Simpla Admin logo" /></a>
		  
			<!-- Sidebar Profile links -->
			<div id="profile-links">
				Hello, <a href="#" title="Edit your profile">{{user}}</a>
				<br />
				<a href="/" title="查看站点">查看站点</a> | <a href="/logout" title="Sign Out">登出</a>
			</div>        
			
			<ul id="main-nav">  <!-- Accordion Menu -->
				
				<li>
					<a href="/admin/" class="nav-top-item no-submenu"> <!-- Add the class "no-submenu" to menu items with no sub menu -->
						仪表盘
					</a>       
				</li>
				
				<li> 
					<a href="#" class="nav-top-item current"> <!-- Add the class "current" to current menu item -->
					文章
					</a>
					<ul>
						<li><a href="/admin/write">写文章</a></li>
						<li><a href="/admin/articles">所有文章</a></li> <!-- Add class "current" to sub menu items also -->
						<li><a href="/admin/comments">管理评论</a></li>
						<li><a class="current" href="/admin/categories">管理分类</a></li>
					</ul>
				</li>
				
				<li>
					<a href="#" class="nav-top-item">
						页面
					</a>
					<ul>
						<li><a href="/admin/pages/new">新建页面</a></li>
						<li><a href="/admin/pages">管理页面</a></li>
					</ul>
				</li>
				
				<li>
					<a href="#" class="nav-top-item">
						设置
					</a>
					<ul>
						<li><a href="/admin/setting">常规</a></li>
					</ul>
				</li>      
				
			</ul> <!-- End #main-nav -->
			
		</div></div> <!-- End #sidebar -->
		
		<div id="main-content"> <!-- Main Content Section with everything -->
			<div class="content-box"><!-- Start Content Box -->
				
				<div class="content-box-header">
					
					<h3>分类目录</h3>
					<ul class="content-box-tabs">
					%if 'info' in dir():
						%if info:
							%tab1=''
							%tab2='default-tab'
							<li><a href="#tab1">查看分类目录</a></li> <!-- href must be unique and match the id of target div -->
							<li><a href="#tab2" class="default-tab">新建分类目录</a></li>
						%else:
							%tab2=''
							%tab1='default-tab'
							<li><a href="#tab1" class="default-tab">查看分类目录</a></li> <!-- href must be unique and match the id of target div -->
							<li><a href="#tab2">新建分类目录</a></li>
						%end
					%else:
						%tab1=''
						%tab2='default-tab'
						<li><a href="#tab1">查看分类目录</a></li> <!-- href must be unique and match the id of target div -->
						<li><a href="#tab2"  class="default-tab">编辑分类目录</a></li>							
					%end
					</ul>
					
					<div class="clear"></div>
					
				</div> <!-- End .content-box-header -->
				%if 'info' in dir():
				%if info:
			<div class="notification success png_bg">
				<a href="#" class="close"><img src="/static/resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
				<div>
					分类目录添加成功<span id="jumpTo">3</span>秒后自动跳转
					<script type="text/javascript">countDown(3,'/admin/categories');</script>
				</div>
			</div>
			   %end
			   %end
			   
			   %if 'error' in dir():
			   %if error:
			 <div class="notification error png_bg">
				<a href="#" class="close"><img src="/static/resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
				<div>
				{{errorinfo}}
				</div>
			</div>
			%end
			%end
				
				<div class="content-box-content">
					
					<div class="tab-content {{tab1}}" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
						<form action="/admin/categories/bulkdel" method="post">
						<table>
							
							<thead>
								<tr>
								   <th><input class="check-all" type="checkbox" /></th>
								   <th>分类</th>
								   <th>描述</th>
								   <th></th>
								   <th>文章</th>
								   <th>操作</th>
								</tr>
								
							</thead>
						 
							<tfoot>
								<tr>
									<td colspan="6">
										<div class="bulk-actions align-left">
											<select name="dropdown">
												<option value="option1">选择一个操作</option>
												<option value="del">删除</option>
											</select>
											<input type="submit" class="button" name="submit" id="submit" value="应用" />
										</div>
									</td>
								</tr>
							</tfoot>
						 
							<tbody>
							  %if categories:
							%for cate in categories:
								%cid = cate.get('_id')
								%catename = cate['name']
								%artnum  = int(cate['artnum'])
								<tr>

									<td><input type="checkbox" name="cate-{{cid}}" id="cate-{{cid}}" value="{{cid}}" /></td>
									<td>{{catename}}</td>
									<td><a href="#" title="title"></a></td>
									<td></td>
									<td>{{artnum}}</td>
									<td>
										<!-- Icons -->
										<a href="/admin/categories/edit/{{cid}}" title="编辑"><img src="/static/resources/images/icons/pencil.png" alt="编辑" /></a>
										<a href="/admin/categories/del/{{cid}}" title="删除"><img src="/static/resources/images/icons/cross.png" alt="删除" /></a> 
									</td>
								</tr>
							%end
								%end
							</tbody>
							
						</table>
						</form>
						
					</div> <!-- End #tab1 -->

				<div class="tab-content {{tab2}}" id="tab2">
					%if 'cate_edit' in dir():
							<form action="/admin/categories/edit/post" method="post">
							
							<fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								
								<p>
									<label>分类目录名称</label>
										<input class="text-input small-input" type="text" id="cate" name="cate" value="{{cate_edit['name'] or ''}}" /> 
										<br /><small>输入分类目录名称</small>
								</p>
								<p>
									<input type="hidden" name="cateid" value="{{cate_edit.get('_id','')}}" />
									<input class="button" type="submit" value="更新" />
								</p>
							%else:
							
							<form action="/admin/categories/add" method="post">
							<fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								
								<p>
									<label>分类目录名称</label>
										<input class="text-input small-input" type="text" id="cate" name="cate" /> 
										<br /><small>输入分类目录名称</small>
								</p>
								<p>
									<input class="button" type="submit" value="添加" />
							    </p>
							%end
							</fieldset>
							
							<div class="clear"></div><!-- End .clear -->
							
						</form>
						
					</div> <!-- End #tab2 -->        
					
				</div> <!-- End .content-box-content -->
				
			</div> <!-- End .content-box -->
			
			<div class="clear"></div>
			
			<div id="footer">
				<small> <!-- Remove this notice or replace it with whatever you want -->
						&#169; Copyright 2012 cold night | Powered by <a href="http://www.linuxzen.com">cold night</a> | <a href="#">Top</a>
				</small>
			</div><!-- End #footer -->
			
		</div> <!-- End #main-content -->
		
	</div></body>
  
</html>
